package com.radiant.data.entity;

import javax.xml.bind.annotation.XmlRootElement;

import com.radiant.data.annotation.Entity;
import com.radiant.data.annotation.Persist;
import com.radiant.data.entity.DevelopmentTrack.Height;
import com.radiant.data.entity.DevelopmentTrack.Weight;

@XmlRootElement
@Entity(name="Measurement")
public class Measurement extends WallEntity implements ActivityFeedable {

	@Persist(name="measurementId", itemName=true)
	private String measurementId;
	
	@Persist(name="childId")
	private String childId;
	
	@Persist(name="month")
	private Month month;

	@Persist(name="height")
	private Height height;

	@Persist(name="weight")
	private Weight weight;

	public String getChildId() {
		return childId;
	}

	public void setChildId(String childId) {
		this.childId = childId;
	}

	public Month getMonth() {
		return month;
	}

	public void setMonth(Month month) {
		this.month = month;
	}

	public String getMeasurementId() {
		return measurementId;
	}

	public void setMeasurementId(String measurementId) {
		this.measurementId = measurementId;
	}

	public Height getHeight() {
		return height;
	}

	public void setHeight(Height height) {
		this.height = height;
	}

	public Weight getWeight() {
		return weight;
	}

	public void setWeight(Weight weight) {
		this.weight = weight;
	}

	public void addToActivity(Activity activity) {
		activity.setMeasurement(this);
	}

	public void addMessageToActivity(Activity activity, User creator,
			Child child) {
		StringBuffer sb = new StringBuffer();
		sb.append(creator.getUserName()).append(" recorded a new measurement for");
		sb.append(child.getName());
		activity.setMessage(sb.toString());
	}
	
}
